package com.www.applyword.adapter;

import android.content.Context;
import android.content.Intent;
import android.widget.Button;

import com.allen.library.CircleImageView;
import com.classic.adapter.BaseAdapterHelper;
import com.classic.adapter.CommonRecyclerAdapter;
import com.www.applyword.R;
import com.www.applyword.bean.BookFriendBean;
import com.www.applyword.ui.chat.AddFriendActivity;
import com.www.applyword.utils.ImageUtil;
import com.www.applyword.utils.Utils;

/**
 * author : huang
 * date   : 2019/10/21 0021 15:06
 * version: 1.0
 * @author Administrator
 */
public class JobAdapter extends CommonRecyclerAdapter<BookFriendBean> {



    public JobAdapter(Context context) {
        super(context, R.layout.item_list_book);
    }


    @Override
    public void onUpdate(BaseAdapterHelper helper, BookFriendBean item, int position) {
        CircleImageView view = helper.getView(R.id.cv_my_photo);
        ImageUtil.setImage(view, item.getHeadImage());
        helper.setText(R.id.tv_name,item.getNikeName());
        Button  bt_add =  helper.getView(R.id.sb_add);
        if (item.getRelationship() == 0){

        }else {
            bt_add.setText("已添加");
            bt_add.setBackground(null);
        }
        bt_add.setOnClickListener(v -> {
            Intent intent = new Intent(Utils.getContext(), AddFriendActivity.class);
            intent.putExtra("item", item);
            Utils.getContext().startActivity(intent);
         });
    }
}

